// 应用处理类
import { DB_NAME, DB_PATH } from '@/uni_modules/stars-UniTS-SQLite-ORM/components/stars-UniTS-SQLite-ORM/dbOrm/config/dbconfig';
import { openSqlite } from '@/uni_modules/stars-UniTS-SQLite-ORM/components/stars-UniTS-SQLite-ORM/dbOrm/db/SqliteHelper';
import { setupBackButtonHandler } from '@/uni_modules/stars-UniTS-SQLite-ORM/components/stars-UniTS-SQLite-ORM/app/backButtonHandler';
import { TableInit } from '@/uni_modules/stars-UniTS-SQLite-ORM/components/stars-UniTS-SQLite-ORM/dbOrm/db/TableInit';
/**
 * APP打开处理
 * @return 
 */
export async function appOpen() {
	console.log("-----------------------");
	try {
		// 打开数据库
		openSqlite(DB_NAME, DB_PATH);
		// 初始化数据
		TableInit.tableInit();
	} catch (error) {
		console.error('Failed to open database:', error);
	}
	// 退出应用处理
	setupBackButtonHandler()
}